package com.aaa.service.impl;


import com.aaa.dao.SDSQuesTtionDao;
import com.aaa.entity.PageSort;
import com.aaa.entity.QuesTion;
import com.aaa.service.SDSQuesTionService;
import com.aaa.util.Enum01;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SDSQuesTionServiceImpl implements SDSQuesTionService{
    @Autowired
    private SDSQuesTtionDao quesTtionDaoSDS;
//    查询
    @Override
    public List<QuesTion> FindAllSDS(PageSort pageSort) {
        PageHelper.startPage(pageSort.getPage(),pageSort.getLimit());
        List<QuesTion> quesTions = quesTtionDaoSDS.FindAllQuesTionSDS(pageSort);
        return quesTions;
    }

    @Override
    public Enum01 insertQuesTionSDS(QuesTion quesTion) {
        int i = quesTtionDaoSDS.insertQuesTionSDS(quesTion);
        if (i>0){
            return Enum01.SUCCESS;
        }
        return Enum01.FAIL;
    }

    @Override
    public boolean deleteQuesTionSDS(String id) {
        int i = quesTtionDaoSDS.deleteQuesTionSDS(id);
        if (i>0){
            return true;
        }
        return false;
    }

    @Override
    public int updataQuesTionSDS(QuesTion quesTion) {
        return quesTtionDaoSDS.updataQuesTionSDS(quesTion);
    }

    @Override
    public boolean QuesTionrepeatSDS(QuesTion quesTion) {
        List<QuesTion> quesTions = quesTtionDaoSDS.QuesTionrepeatSDS(quesTion);
        if (quesTions!=null&&quesTions.size()>0){
            return true;
        }
        return false;
    }

    @Override
    public List<QuesTion> findAllSds() {
        return quesTtionDaoSDS.findAllSds();
    }


}
